-- module TestFilmManager where

import Film
import DBS
import FilmManager
import IdObject

f1, f2, f3 :: Film
f1 = Film 1 ("Star Wars", 2000, "George Lucas", "science-fiction", Available, "kolejna czesc sagi")
f2 = Film 2 ("Forrest Gump", 1994, "Robert Zemeckis", "fabularny", Lost, "Oscarowa rola T. Hanksa")
f3 = Film 3 ("Mis", 1972, "Stanislaw Bareja", "komedia", Loaned, "film demaskujacy absurdy PRL-u lat 70.-tych")
f4 = Film 4 ("Kapitan Sowa na tropie", 1965, "Stanislaw Bareja", "kryminalny", Available, "pierwszy polski serial kryminalny")
d1, d2, d3 :: DBS
d1 = insertFilm (getFilmInfo f1) empty
d2 = insertFilm (getFilmInfo f2) d1
d3 = insertFilm (getFilmInfo f3) d2
d4 = insertFilm (getFilmInfo f4) d3

dl1 = deleteFilm 2 d3
-- [f1, f3, f4]
dl2 = deleteFilm 5 d3
-- Nothing

d33 = updateFilm (getId f2) d4 3 "Roberto Zemeckis"
-- ok
d333 = updateFilm (getId f2) d4 5 "1"
-- ok
dx = updateFilm 5 d4 5 "lost"
-- Nothing
dx2 = updateFilm 5 d4 7 "lost"
-- Nothing

f11 = searchFilm "George" d4
-- f1
f22 = searchFilm "Forest" d4
-- []
f33 = searchFilm "fabula" d4
-- f2
f44 = searchFilm "Bareja" d4
-- f3, f4
f55 = searchFilm "krym" d4
-- f4
--f66 = searchFilmByYear 2000 d4
f66 = searchFilm "2000" d4
-- f1
--f77 = searchFilmByYear 1973 d4
f77 = searchFilm "1973" d4
-- []
